Skip to content

Remove Unirest from the codebase as it's unmaintained#165

Merged
mckenna merged 1 commit intomasterfrom
p/remove-unirest
Oct 18, 2017
Merged

Remove Unirest from the codebase as it's unmaintained#165
mckenna merged 1 commit intomasterfrom
p/remove-unirest

Conversation

@mckenna
Copy link
Copy Markdown
Member

@mckenna mckenna commented Oct 18, 2017

The current HTTP client, unirest depends on a library that has a security advisory alert. I submitted a PR to them, but it doesn't look like the library is maintained any more.

This removes unirest and introduces request which is an actively maintained http client. I removed the duplication of headers / auth by introducing a request() method. This change will fix #163.

This does slightly change the response however — request does not include a status key in the response, only statusCode key. I left the response alone and updated the tests. It would be possible to merge in a status key if required, but I opted against this as there are possibly more changes that I didn't notice, and it feels a bit like going down the rabbit hole trying to compare both.

@danielhusar
Copy link
Copy Markdown
Contributor

Request have also a wrapper for promise: https://github.com/request/request-promise
Maybe we can use this instead of our custom proxy?

Comment thread lib/client.js
}
promiseProxy(f, req) {
promiseProxy(f, args) {
if (this.promises || !f) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is f supposed to be?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a function, it's either a promise resolver, or a callback passed in at the call site.

@mckenna
Copy link
Copy Markdown
Member Author

mckenna commented Oct 18, 2017

@danielhusar Definitely, wanted to keep the changes here as self contained as possible for now. I think following up with Request's promise wrapper, and removing callbacks would be a good next step (we should just support promises by default).

@mckenna mckenna merged commit b1da5b2 into master Oct 18, 2017
@mckenna mckenna deleted the p/remove-unirest branch October 18, 2017 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security advisory in dependency

3 participants